package dormatory;

import java.util.ArrayList;
import java.util.List;

public class Room {
	
	private List<Person> personList = new ArrayList<Person>();
	private String number;
	private int sizeLimit;
	private int floorLevel;

	
	// Pass in a size limit when you create the room
	public Room(String number, int sizeLimit) {
		this.number = number;
		this.sizeLimit = sizeLimit;
	}
	
	// How do I get the room number to come up automatically rather than
	// have to manually type it out?==
	public String toString () {
		StringBuilder sb = new StringBuilder();
		sb.append("Room number ");
		sb.append(number);
		return sb.toString();
	}
	
	
	public void addPerson(Person person) {
		// check to see if the room is full
		if (personList.size() == sizeLimit) {
			// the room is already full, so throw an exception
			throw new RuntimeException("Dorm is already full, cannot add Person");
		}
		// add the Person to the internal list
		personList.add(person);
	}
	
	public void removePerson(Person person) {
		personList.remove(person);
	}
	
	public int percentAvailable() {
		return (sizeLimit / personList.size()) * 10;
	}
	
	public int bedsAvailable() {
		return (sizeLimit-personList.size());
	}
		
	public int totalGuests() {
		return (personList.size());
	}

	public List<Person> getPersonList() {
		return personList;
	}

	public String getNumber() {
		return number;
	}

	public void setNumber(String number) {
		this.number = number;
	}

	public int getSizeLimit() {
		return sizeLimit;
	}

	public int getFloorLevel() {
		return floorLevel;
	}

	
	
	

}
